package org.kumas.sgrpc.remoting.transport.netty;

import org.kumas.sgrpc.common.URL;
import org.kumas.sgrpc.remoting.ChannelHandler;
import org.kumas.sgrpc.remoting.Client;
import org.kumas.sgrpc.remoting.RemotingException;
import org.kumas.sgrpc.remoting.RemotingServer;
import org.kumas.sgrpc.remoting.Transporter;

/*
 * 对上层开放的接口入口
 */
public class NettyTransporter implements Transporter {

    public static final String NAME = "NettyTransporter";

    @Override
    public RemotingServer bind(URL url, ChannelHandler handler) throws RemotingException {
        return new NettyServer(url, handler);
    }

    @Override
    public Client connect(URL url, ChannelHandler handler) throws RemotingException {
        return new NettyClient(url, handler);
    }
}